package com.myway.dto.order;

import com.myway.dto.order.domain.BookingType;
import com.myway.dto.order.domain.OrderStatus;
import com.myway.dto.order.domain.TicketType;
import com.myway.dto.payment.DTOPayment;
import com.myway.dto.ticket.DTOFltChange;
import com.myway.dto.ticket.DTOFltRefund;
import com.myway.dto.user.DTOUser;
import com.myway.dto.waybill.DTOWayBill;

import java.io.Serializable;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
 * @类名称：DTOOrder 
 * @类描述：订单类 
 * @创建时间：2015年11月11日 下午7:49:39 
 * @author Jiang.Yida
 * @version V1.0
 */
public class DTOOrder implements Serializable,Cloneable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2117680661563418372L;
	private Long id;
	private String orderNo;
	private TicketType ticketType;
	private Date createTime;
	//提前购票时要用的创建时间（无时分秒的）
	private Date createTimeforTQ;
	private Long userId;
	private DTOUser user;
	private String userName;
	private String officeNo;
	private String currency;
	private OrderStatus status;
	private String contactName;
	private String contactTel;
	private String contactMobile;
	private String contactEmail;
	private String contactAddress;
	private Date timeLimit;
	private String airlineCode;
	private boolean pnrImport;	//是否是PNR入库订单
	private String responsibility;
	private String mobile;//非注册用户订单
	private String ipAddress;
	private String source;//added by st-zuo 添加订单来源
//	private String orderType;//订单类型
	private Integer issurSMSSend = 0;//出票短信是否已发送：1已发送，0未发送
	private List<DTOIllnessAnnex> illnessAnnex = new ArrayList<DTOIllnessAnnex>();//病退附件信息

	
	/**
	 * 团队或散客预定
	 */
	private BookingType bookingType = BookingType.INDIVIDUAL;
	private List<DTOSegment> segmentList = new ArrayList<DTOSegment>();//航段集合
	private List<DTOPassenger> passengerList = new ArrayList<DTOPassenger>();//旅客集合
	private List<DTOFltRefund> refund = new ArrayList<DTOFltRefund>();//退票列表
	


	/**
	 * paxSegsInfo: 航段简略信息
	 * 联系人,电话,航班号,客票号,基础票价,税费
	 */
	private List<String> paxSegsInfo;//contact_name,mobile|tel,fingno,ticketno,netFare,airportTax+fuelTax+otherTaxes+insurance
	
	
	private List<DTOPayment> payments=new ArrayList<DTOPayment>();//支付详情列表
	private List<DTOFltChange> fltChange = new ArrayList<DTOFltChange>();//改升单列表
	private List<DTOOrderExtbuy> extbuyList = new ArrayList<DTOOrderExtbuy>();//补购列表
	
	
	private String paymentNo;//支付流水号
	private String fixStatus;//差错异常订单处理标记
	private String fixUserName;//处理账号
	private Date fixDate;//处理时间
	private Date payStartTime;//支付时间段起始
	private Date payEndTime;//支付时间段结束
	
	/**
	 * @return the fltChange
	 */
	public void addFltChange(DTOFltChange dtofltChange) {
		this.fltChange.add(dtofltChange);
	}
	
	/**
	 * @return the fltChange
	 */
	public List<DTOFltChange> getFltChange() {
		return fltChange;
	}


	/**
	 * @param fltChange the fltChange to set
	 */
	public void setFltChange(List<DTOFltChange> fltChange) {
		this.fltChange = fltChange;
	}


	/**
	 * 免票所需积分
	 */
//	private List<DtoLmkPointRecord> dtoPoints = new ArrayList<DtoLmkPointRecord>();
	/**
	 * 订单所需要积分
	 */
	private Integer orderPoint = new Integer(0);
	/**
	 * 支付免票
	 */
//	private List<DTOLmkFreeTicket> dtoFreeTickets = new ArrayList<DTOLmkFreeTicket>();
	/**
	 * 需要支付的免票张数
	 */
	private Integer needFreeTickets = new Integer(0);
	/**
	 * 历史订单总额
	 */
	private BigDecimal historyAllMoney;
	/**
	 * 订单总额
	 */
	private BigDecimal orderAllMoney;
	/**
	 * 未支付总额
	 */
	private BigDecimal orderAmount;
	/**
	 * 已支付金额
	 */
	private BigDecimal orderHasPay;
	
	/**
	 * 提交订单前
	 * 订单价格
	 */
	private BigDecimal totalFare;
	
	/**
	 * 提交订单前
	 * 票面总价
	 */
	private BigDecimal ticketprice;
	

	/**
	 * 积分（金币）支付金额
	 */
	private double pointAmount =0 ;
	//added by shuai-wang
	private BigDecimal mailFee;//行程单邮寄费
	private List<DTOWayBill> dtoWayBill;
	private int   international= 0;//是否国际票订单,0非国际，1国际票订单
//	private DTOHotel dtoHotel;
	//优惠券Order
	private String couponNo;//优惠券号码
	private BigDecimal onSaleAmount;//优惠总额
	private BigDecimal quotaValue;//消费限额
	//是否全额积分支付订单 Y/N
	private String fullPointPay;
	
	private int groupMark= 0;//是否打包产品订单,0非打包，1打包订单（打包往返产品）

	private String cardRemark;
	
	private String extraRemark;//辅营标志
	
	public double getPointAmount() 
	{
		return pointAmount;
	}

	public void setPointAmount(double pointAmount) {
		this.pointAmount = pointAmount;
	}

	/**
	 * @return the international
	 */
	public int getInternational()
	{
		return international;
	}

	
	/**
	 * @param international the international to set
	 */
	public void setInternational(int international)
	{
		this.international = international;
	}

	public Object clone() throws CloneNotSupportedException {   
	        
		return super.clone();   
	}  
	
	/**
	 * 构造函数
	 */	
	public DTOOrder() {}

	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}



	/**
	 * @param id the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}



	/**
	 * @return the orderNo
	 */
	public String getOrderNo() {
		return orderNo;
	}



	/**
	 * @param orderNo the orderNo to set
	 */
	public void setOrderNo(String orderNo) {
		this.orderNo = orderNo;
	}



	/**
	 * @return the ticketType
	 */
	public TicketType getTicketType() {
		return ticketType;
	}



	/**
	 * @param ticketType the ticketType to set
	 */
	public void setTicketType(TicketType ticketType) {
		this.ticketType = ticketType;
	}



	/**
	 * @return the createTime
	 */
	public Date getCreateTime() {
		return createTime;
	}
 
	public Date getCreateTimeforTQ() {
		return createTimeforTQ;
	}

	/**
	 * @param createTime the createTime to set
	 */
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
		if (createTime == null){
			this.createTimeforTQ = null;
		}else{
			SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
			String temp = formatter.format(createTime);
			try {
				this.createTimeforTQ = formatter.parse(temp);
			} catch (ParseException e) {
				e.printStackTrace();
			}
		}
	}

	


	/**
	 * @return the userId
	 */
	public Long getUserId() {
		return userId;
	}



	/**
	 * @param userId the userId to set
	 */
	public void setUserId(Long userId) {
		this.userId = userId;
	}

	/**
	 * @return the user
	 */
	public DTOUser getUser() {
		return this.user;
	}



	/**
	 * @param user the user to set
	 */
	public void setUser(DTOUser user) {
		this.user = user;
	}



	/**
	 * @return the userName
	 */
	public String getUserName() {
		return userName;
	}



	/**
	 * @param userName the userName to set
	 */
	public void setUserName(String userName) {
		this.userName = userName;
	}



	/**
	 * @return the officeNo
	 */
	public String getOfficeNo() {
		return officeNo;
	}



	/**
	 * @param officeNo the officeNo to set
	 */
	public void setOfficeNo(String officeNo) {
		this.officeNo = officeNo;
	}



	/**
	 * @return the currency
	 */
	public String getCurrency() {
		return currency;
	}



	/**
	 * @param currency the currency to set
	 */
	public void setCurrency(String currency) {
		this.currency = currency;
	}



	/**
	 * @return the status
	 */
	public OrderStatus getStatus() {
		return status;
	}

	/**
	 * @param status the status to set
	 */
	public void setStatus(OrderStatus status) {
		this.status = status;
	}



	/**
	 * @return the contactName
	 */
	public String getContactName() {
		return contactName;
	}



	/**
	 * @param contactName the contactName to set
	 */
	public void setContactName(String contactName) {
		this.contactName = contactName;
	}



	/**
	 * @return the contactTel
	 */
	public String getContactTel() {
		return contactTel;
	}



	/**
	 * @param contactTel the contactTel to set
	 */
	public void setContactTel(String contactTel) {
		this.contactTel = contactTel;
	}



	/**
	 * @return the contactMobile
	 */
	public String getContactMobile() {
		return contactMobile;
	}



	/**
	 * @param contactMobile the contactMobile to set
	 */
	public void setContactMobile(String contactMobile) {
		this.contactMobile = contactMobile;
	}



	/**
	 * @return the contactEmail
	 */
	public String getContactEmail() {
		return contactEmail;
	}



	/**
	 * @param contactEmail the contactEmail to set
	 */
	public void setContactEmail(String contactEmail) {
		this.contactEmail = contactEmail;
	}



	/**
	 * @return the contactAddress
	 */
	public String getContactAddress() {
		return contactAddress;
	}



	/**
	 * @param contactAddress the contactAddress to set
	 */
	public void setContactAddress(String contactAddress) {
		this.contactAddress = contactAddress;
	}

	/**
	 * @return the segmentList
	 */
	public List<DTOSegment> getSegmentList() {
		return segmentList;
	}



	/**
	 * @param segmentList the segmentList to set
	 */
	public void setSegmentList(List<DTOSegment> segmentList) {
		this.segmentList = segmentList;
	}



	/**
	 * @return the passengerList
	 */
	public List<DTOPassenger> getPassengerList() {
		return passengerList;
	}

	/**
	 * @return the passengerList
	 */
	public void addPassenger(DTOPassenger dtoPassenger) {
		this.passengerList.add(dtoPassenger);
	}

	/**
	 * @param passengerList the passengerList to set
	 */
	public void setPassengerList(List<DTOPassenger> passengerList) {
		this.passengerList = passengerList;
	}

	


	/**
	 * @param dtoSegment the dtoSegment to set
	 */
	public void addDTOSegment(DTOSegment dtoSegment) {
		this.segmentList.add(dtoSegment);
	}



	/**
	 * @return the orderAmount
	 */
	public BigDecimal getOrderAmount() {
		return this.orderAmount;
	}

	/**
	 * @param orderAmount the orderAmount to set
	 */
	public void setOrderAmount(BigDecimal orderAmount) {
		this.orderAmount = orderAmount;
	}

	/**
	 * @return the payments
	 */
	public List<DTOPayment> getPayments() {
		return this.payments;
	}

	/**
	 * @param payments the payments to set
	 */
	public void setPayments(List<DTOPayment> payments) {
		this.payments = payments;
	}
	
	/**
	 * @param payment the payment to set
	 */
	public void addPayment(DTOPayment payment){
		this.payments.add(payment);
	}



	/**
	 * @return the timeLimit
	 */
	public Date getTimeLimit() {
		return timeLimit;
	}



	/**
	 * @param timeLimit the timeLimit to set
	 */
	public void setTimeLimit(Date timeLimit) {
		this.timeLimit = timeLimit;
	}



	/**
	 * @return the bookingType
	 */
	public BookingType getBookingType() {
		return bookingType;
	}

	/**
	 * @param bookingType the bookingType to set
	 */
	public void setBookingType(BookingType bookingType) {
		this.bookingType = bookingType;
	}



	/**
	 * @return the airlineCode
	 */
	public String getAirlineCode() {
		return this.airlineCode;
	}



	/**
	 * @param airlineCode the airlineCode to set
	 */
	public void setAirlineCode(String airlineCode) {
		this.airlineCode = airlineCode;
	}



	/**
	 * @return the responsibility
	 */
	public String getResponsibility() {
		return responsibility;
	}



	/**
	 * @param responsibility the responsibility to set
	 */
	public void setResponsibility(String responsibility) {
		this.responsibility = responsibility;
	}
	/**
	 * @return the pnrImport
	 */
	public boolean isPnrImport() {
		return this.pnrImport;
	}
	/**
	 * @param pnrImport the pnrImport to set
	 */
	public void setPnrImport(boolean pnrImport) {
		this.pnrImport = pnrImport;
	}

	
	/**
	 * @return the orderAllMoney
	 */
	public BigDecimal getOrderAllMoney()
	{
		return orderAllMoney;
	}

	
	/**
	 * @param orderAllMoney the orderAllMoney to set
	 */
	public void setOrderAllMoney(BigDecimal orderAllMoney)
	{
		this.orderAllMoney = orderAllMoney;
	}

	
	/**
	 * @return the orderHasPay
	 */
	public BigDecimal getOrderHasPay()
	{
		return orderHasPay;
	}

	
	/**
	 * @param orderHasPay the orderHasPay to set
	 */
	public void setOrderHasPay(BigDecimal orderHasPay)
	{
		this.orderHasPay = orderHasPay;
	}

	/**
	 * @return the dtoPoints
	 */
//	public List<DtoLmkPointRecord> getDtoPoints()
//	{
//		return dtoPoints;
//	}

	/**
	 * @param dtoPoints the dtoPoints to set
	 */
//	public void setDtoPoints(List<DtoLmkPointRecord> dtoPoints)
//	{
//		this.dtoPoints = dtoPoints;
//	}

	/**
	 * @return the orderPoint
	 */
	public Integer getOrderPoint()
	{
		return orderPoint;
	}

	/**
	 * @param orderPoint the orderPoint to set
	 */
	public void setOrderPoint(Integer orderPoint)
	{
		this.orderPoint = orderPoint;
	}

	/**
	 * @return the dtoFreeTickets
	 */
//	public List<DTOLmkFreeTicket> getDtoFreeTickets()
//	{
//		return dtoFreeTickets;
//	}

	/**
	 * @param dtoFreeTickets the dtoFreeTickets to set
	 */
//	public void setDtoFreeTickets(List<DTOLmkFreeTicket> dtoFreeTickets)
//	{
//		this.dtoFreeTickets = dtoFreeTickets;
//	}

	/**
	 * @return the needFreeTickets
	 */
	public Integer getNeedFreeTickets()
	{
		return needFreeTickets;
	}

	/**
	 * @param needFreeTickets the needFreeTickets to set
	 */
	public void setNeedFreeTickets(Integer needFreeTickets)
	{
		this.needFreeTickets = needFreeTickets;
	}

//	public void addDtoPoint(DtoLmkPointRecord point)
//	{
//		this.dtoPoints.add(point);
//	}
	
	/**
	 * 
	 * @param dtoFreeTicket
	 *
	 * @author 郑兴(zhengxing)
	 * @description
	 *
	 * 添加支付的免票
	 *
	 * 2010-1-15
	 */
//	public void addFreeTicket(DTOLmkFreeTicket dtoFreeTicket)
//	{
//		this.dtoFreeTickets.add(dtoFreeTicket);
//	}

	public BigDecimal getMailFee() {
		return mailFee;
	}

	public void setMailFee(BigDecimal mailFee) {
		this.mailFee = mailFee;
	}

	public List<DTOWayBill> getDtoWayBill() {
		return dtoWayBill;
	}

	public void setDtoWayBill(List<DTOWayBill> dtoWayBill) {
		this.dtoWayBill = dtoWayBill;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public String getIpAddress() {
		return ipAddress;
	}

	public void setIpAddress(String ipAddress) {
		this.ipAddress = ipAddress;
	}

	public String getSource() {
		return source;
	}


	public void setSource(String source) {
		this.source = source;
	}


//	public DTOHotel getDtoHotel() {
//		return dtoHotel;
//	}
//
//
//	public void setDtoHotel(DTOHotel dtoHotel) {
//		this.dtoHotel = dtoHotel;
//	}

	public BigDecimal getQuotaValue() {
		if(quotaValue==null){
			quotaValue=new BigDecimal(0);
		}
		return quotaValue;
	}


	public void setQuotaValue(BigDecimal quotaValue) {
		if(quotaValue==null){
			quotaValue=new BigDecimal(0);
		}
		this.quotaValue = quotaValue;
	}


	public String getCouponNo() {
		return couponNo;
	}


	public void setCouponNo(String couponNo) {
		this.couponNo = couponNo;
	}


	public BigDecimal getOnSaleAmount() {
		if(onSaleAmount==null){
			onSaleAmount=new BigDecimal(0);
		}
		return onSaleAmount;
	}


	public void setOnSaleAmount(BigDecimal onSaleAmount) {
		if(onSaleAmount==null){
			onSaleAmount=new BigDecimal(0);
		}
		this.onSaleAmount = onSaleAmount;
	}

	public String getFullPointPay() {
		return fullPointPay;
	}

	public void setFullPointPay(String fullPointPay) {
		this.fullPointPay = fullPointPay;
	}
	
	
	/**
	 * 提交订单前
	 * 订单价格
	 */
	public BigDecimal getTotalFare() {
		if(totalFare == null){return new BigDecimal(0);}
		return totalFare;
	}

	/**
	 * 提交订单前
	 * 订单价格
	 */
	public void setTotalFare(BigDecimal totalFare) {
		if(totalFare==null){totalFare=new BigDecimal(0);}
		this.totalFare = totalFare;
	}

	/**
	 * 提交订单前
	 * 订单价格
	 */
	public BigDecimal getTicketprice() {
		if(ticketprice == null){return new BigDecimal(0);}
		return ticketprice;
	}

	/**
	 * 提交订单前
	 * 订单价格
	 */
	public void setTicketprice(BigDecimal ticketprice) {
		if(ticketprice==null){ticketprice=new BigDecimal(0);}
		this.ticketprice = ticketprice;
	}

	/**
	 * @return the groupMark
	 */
	public int getGroupMark() {
		return groupMark;
	}

	/**
	 * @param groupMark the groupMark to set
	 */
	public void setGroupMark(int groupMark) {
		this.groupMark = groupMark;
	}

	/**
	 * @return the issurSMSSend
	 */
	public Integer getIssurSMSSend() {
		return issurSMSSend;
	}
	
	/**
	 * @param issurSMSSend the issurSMSSend to set
	 */
	public void setIssurSMSSend(Integer issurSMSSend) {
		this.issurSMSSend = issurSMSSend;
	}
	
	public String getCardRemark() {
		return cardRemark;
	}
	
	public void setCardRemark(String cardRemark) {
		this.cardRemark = cardRemark;
	}

	public void setExtraRemark(String extraRemark) {
		this.extraRemark = extraRemark;
	}

	public String getExtraRemark() {
		return extraRemark;
	}

	public List<String> getPaxSegsInfo() {
		return paxSegsInfo;
	}

	public void setPaxSegsInfo(List<String> paxSegsInfo) {
		this.paxSegsInfo = paxSegsInfo;
	}

	public void setCreateTimeforTQ(Date createTimeforTQ) {
		this.createTimeforTQ = createTimeforTQ;
	}

	public String getPaymentNo() {
		return paymentNo;
	}

	public void setPaymentNo(String paymentNo) {
		this.paymentNo = paymentNo;
	}

	public String getFixStatus() {
		return fixStatus;
	}

	public void setFixStatus(String fixStatus) {
		this.fixStatus = fixStatus;
	}

	public String getFixUserName() {
		return fixUserName;
	}

	public void setFixUserName(String fixUserName) {
		this.fixUserName = fixUserName;
	}

	public Date getFixDate() {
		return fixDate;
	}

	public void setFixDate(Date fixDate) {
		this.fixDate = fixDate;
	}

	public Date getPayStartTime() {
		return payStartTime;
	}

	public void setPayStartTime(Date payStartTime) {
		this.payStartTime = payStartTime;
	}

	public Date getPayEndTime() {
		return payEndTime;
	}

	public void setPayEndTime(Date payEndTime) {
		this.payEndTime = payEndTime;
	}

	public List<DTOFltRefund> getRefund() {
		return refund;
	}

	public void setRefund(List<DTOFltRefund> refund) {
		this.refund = refund;
	}
	public List<DTOIllnessAnnex> getIllnessAnnex() {
		return illnessAnnex;
	}

	public void setIllnessAnnex(List<DTOIllnessAnnex> illnessAnnex) {
		this.illnessAnnex = illnessAnnex;
	}

	public List<DTOOrderExtbuy> getExtbuyList() {
		return extbuyList;
	}

	public void setExtbuyList(List<DTOOrderExtbuy> extbuyList) {
		this.extbuyList = extbuyList;
	}

	public BigDecimal getHistoryAllMoney() {
		return historyAllMoney;
	}

	public void setHistoryAllMoney(BigDecimal historyAllMoney) {
		this.historyAllMoney = historyAllMoney;
	}

//	public String getOrderType() {
//		return orderType;
//	}
//
//	public void setOrderType(String orderType) {
//		this.orderType = orderType;
//	}
	
}
